home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / misc / sci / WorldMap_bin.lha / WorldMap / Src / WMPrefs.c < prev    next >
C/C++ Source or Header  |  1998-01-15  |  3KB  |  89 lines

  1. //Program IFF;
  2.  
  3. #include <exec/types.h>
  4. #include <libraries/reqtools.h>
  5.  
  6. #include <clib/exec_protos.h>
  7. #include <clib/dos_protos.h>
  8. #include <clib/reqtools_protos.h>
  9.  
  10. #include <pragma/reqtools.h>
  11.  
  12. #include <WMap.h>
  13.  
  14. #include <iostream.h>
  15. #include <string.h>
  16. #include <wbstartup.h>
  17.  
  18.  
  19. struct Library *IntuitionBase=NULL;
  20. struct Library *GfxBase=NULL;
  21. struct Library *DBase=NULL;
  22. struct Library *ReqToolsBase=NULL;
  23.  
  24. WPreferences           WPrefs;
  25. rtScreenModeRequester *MySReq=NULL;
  26.  
  27. //APTR a;
  28. LONG l;
  29. BPTR FHandle;
  30.  
  31.  
  32.  
  33. void main(void)
  34.  
  35. {
  36. IntuitionBase=OpenLibrary("intuition.library",39); 
  37. if (IntuitionBase) 
  38.    {
  39.    GfxBase=OpenLibrary("graphics.library",39);
  40.    if (GfxBase)
  41.       {
  42.       DBase=OpenLibrary("dos.library",39);
  43.       if (DBase)
  44.          {
  45.          ReqToolsBase=OpenLibrary("reqtools.library",0);
  46.          if (ReqToolsBase)
  47.             {
  48.             rtEZRequest("Please select a screen with\n a size of 640x512 at least!","OK",NULL,NULL);
  49.             MySReq=(rtScreenModeRequester*)rtAllocRequestA(RT_SCREENMODEREQ,NULL);
  50.             if (MySReq)
  51.                {
  52.                MySReq->Flags=SCREQB_SIZEGADS;
  53.                rtChangeReqAttr(MySReq,0,TAG_DONE);
  54.                if (rtScreenModeRequest(MySReq,"Select a new screenmode!",TAG_DONE,0))
  55. /*                                       RTSC_MinWidth,640,
  56.                                        RTSC_MinHeight,512,
  57.                                        RTSC_MinDepth,8,
  58.                                        TAG_DONE,0))*/
  59.                   {
  60.                   WPrefs.ScrID=MySReq->DisplayID;
  61.                   WPrefs.Width=((UWORD)(MySReq->DisplayWidth/160)*160);
  62.                   if (WPrefs.Width<640) WPrefs.Width=640;
  63.                   WPrefs.Height=((UWORD)(MySReq->DisplayHeight/128)-1)*128;
  64.                   if (WPrefs.Height<384) WPrefs.Height=384;
  65.                   }
  66.                rtFreeRequest(MySReq);
  67.                }
  68.             l=rtEZRequest("Please select a language!","Deutsch|English",NULL,NULL);
  69.             if (l==1) strcpy(WPrefs.Lang,"deutsch") else strcpy(WPrefs.Lang,"english");
  70.             FHandle=Open(WPrefsPath,MODE_NEWFILE);
  71.             if (FHandle)
  72.                {
  73.                Write(FHandle,&WPrefs,sizeof(WPreferences));
  74.                Close(FHandle);
  75.                }
  76.             CloseLibrary(ReqToolsBase);            
  77.             }
  78.          else cout << "Couldn't open reqtools.library!\n";
  79.          CloseLibrary(DBase);
  80.          }
  81.       else cout << "Couldn´t open dos.library!\n";
  82.       CloseLibrary(GfxBase);
  83.       }
  84.    else cout << "Couldn´t open gfx.library!\n";
  85.    CloseLibrary(IntuitionBase);
  86.    }
  87. else cout << "Couldn´t open intuition.library!\n";
  88. }
  89.